package com.boyuan.system;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;

import java.net.InetAddress;
import java.net.UnknownHostException;

@EnableAsync
@MapperScan("com.boyuan.system.mapper")
@SpringBootApplication
public class NingxiaHikCameraApplication {

    public static void main(String[] args) throws UnknownHostException {
        //SpringApplication.run(NingxiaHikCameraApplication.class, args);

        ConfigurableApplicationContext applicationContext = SpringApplication.run(NingxiaHikCameraApplication.class, args);
        Environment environment = applicationContext.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = environment.getProperty("server.port");
        String path = environment.getProperty("server.context-path");
        path = path == null ? "" : path;
        System.out.println("\n--------------------------------------------------------------\n\t" +
                "Application SystemApplication is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
                "swagger-ui: \thttp://" + ip + ":" + port + path + "/doc.html\n\t" +
                "线程数："+ Runtime.getRuntime().availableProcessors()+"\n\t"+
                "--------------------------------------------------------------");
        System.out.println("海康威视摄像头h.264视频流预览服务启动成功！");
    }

}
